package oj;

/**
 * @author 郝文雪
 * @date 2022/8/9 22:43
 * @Description Test
 */
public class LC409 {
    public int longestPalindrome(String s) {
        int[] arr=new int[128];
        int len=0;
        int odd=0;
        char[] str=s.toCharArray();
        for(int i=0;i<str.length;i++){
            arr[str[i]]++;
        }
        for(int i=0;i<arr.length;i++){
            if(arr[i]==0) continue;
            int rem=arr[i]%2;
            len+=arr[i]-rem;
            if(rem==1){
                odd=1;
            }
        }

        return len+odd;
    }
}
